﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine.AI;

namespace Assets.Script.Human.Enemy.Actions
{
    class Follow : EnemyActionBase, IAction
    {
        protected NavMeshAgent navMeshAgent;
        public Follow(EnemyBody body) : base(body)
        {
            navMeshAgent = body.gameObject.GetComponent<NavMeshAgent>();
        }

        public void Interrupt()
        {
            state.Follow = false;
            state.Move = false;
            navMeshAgent.isStopped = true;
            animator.SetFloat("run", 0);
        }

        public void OnEnter(ref object[] o)
        {
            state.Follow = true;
            state.Move = true;
            navMeshAgent.isStopped = false;
            animator.SetFloat("run", data.MoveSpeed);
        }

        public void OnFixedUpdate()
        {
        }

        public void OnUpdate()
        {

        }
    }
}
